Skip to content

[7.x] Scale doubles to floats when necessary to match the field (#78344)#78932

Merged
not-napoleon merged 4 commits intoelastic:7.xfrom
not-napoleon:backport-78344-to-7.x
Oct 11, 2021
Merged

[7.x] Scale doubles to floats when necessary to match the field (#78344)#78932
not-napoleon merged 4 commits intoelastic:7.xfrom
not-napoleon:backport-78344-to-7.x

Conversation

@not-napoleon
Copy link
Member

This fixes a bug where the range aggregation always treats the range end points as doubles, even if the field value doesn't have enough resolution to fill a double. This was creating issues where the range would have a "more precise" approximation of an unrepresentable number than the field, causing the value to fall in the wrong bucket.

Note 1: This does not resolve the case where we have a long value that is not precisely representable as a double. Since the wire format sends the range bounds as doubles, by the time we get to where this fix is operating, we've already lost the precision to act on a big long. Fixing that problem will require a wire format change, and I'm not convinced it's worth it right now.

Note 2: This is probably still broken for ScaledFloats, since they don't implement NumberFieldType.

Resolves #77033

not-napoleon and others added 2 commits October 11, 2021 12:03
)

This fixes a bug where the range aggregation always treats the range end points as doubles, even if the field value doesn't have enough resolution to fill a double. This was creating issues where the range would have a "more precise" approximation of an unrepresentable number than the field, causing the value to fall in the wrong bucket.

Note 1: This does not resolve the case where we have a long value that is not precisely representable as a double. Since the wire format sends the range bounds as doubles, by the time we get to where this fix is operating, we've already lost the precision to act on a big long. Fixing that problem will require a wire format change, and I'm not convinced it's worth it right now.

Note 2: This is probably still broken for ScaledFloats, since they don't implement NumberFieldType.

Resolves elastic#77033
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Oct 11, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@not-napoleon not-napoleon merged commit 5d9001c into elastic:7.x Oct 11, 2021
@not-napoleon not-napoleon deleted the backport-78344-to-7.x branch October 11, 2021 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations backport >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants